Building the Realtime User Experience

キーフレーズ

realtime content realtime updates ls Realtime realtime user experiences ReaItime User Experience Realtime Live Blog lnc latest realtime syndication technologY Previous experience PubSubHubbub f O'Reilly Media O'Reilly 10g0 イ e e ル O'Reilly books Server Push ReaItime Syndication sales promotional use designations River Of Content Ted Roden れ e Use1 カ e Ne 肥 O'ReiIIy Media Ted R0den Ted 犬 Basic Widgets practical JavaScript SUP file JavaScript Object S B N BuiIding ビ R ビ記 sense Of massive amounts Of streaming content ー Chapter following code ー Ch 叩 ter application variables RequestHand1er datastore functionality current user command line firstthing CGIHand1er ReaItime Syndication callback method SMS messages information parameters specific URL handlers User Engagement new content setTimeout WSGIApp1ication Game ltself ー long polling web browser following command く script type callback function previous chapter chat application HTTP request class App1ication mobile number age variable enjoysthin stats URL lt AII handling p 妙 t0 ー Chapter section れビ separate port following controller t お mode parameter actual text application len Older servers SIOW JavaScript implementations realtime able t0 handle view Bruce Eckel's great post imported libraries application 川れ記ツ file く b0dY uid output ofthe intl SMS messages queues 新 w GameUti1s case

目次

TabIe of Contents Preface . lntroduction . What ls Realtime? Changing lnteractions Push Versus Pull Prerequisites Pyth 0 n JavaScript JavaScript Object NO いⅱ on Google's App Engine The Rest 2. ReaItime Syndication . SimpIe Update Pro [ 0C01 (SUP) The SUP file Subscribing with SUP PubIishing with SUP PubSubHubbub The Protocol Subscribing with PubSubHubbub Publishing with PubSubHubbub 3. The Dynamic Homepage (Widgets in PseudoreaItime) . The Basic Widgets HTML Setting Up the JavaScript FriendFeed in Realtime Live lmages lt Was AII a Setup! The Old Versus the New 1 つ」っ」・ 4 ・ 4 一 6 -6 -6 -6 一 / 9 1 フ一つ 0 -1 み 0 「 / O -6 1 1 1 つ」っ」っ」っつつつ 9 9- 0 1 -8 1 4 ー一 -0

4. River Of Content . A Crash Course in Server Push Long P011ing The Bayeux Protocol Cometd Setting Up Your Cometd Environment Putting Everything in lts Place A Realtime Live Blog The Two-Connection Limit Server-Side Filters (with Java) lntegrating Cometd intO Your lnfrastructure 5. Taming the Firehose with Tornad0 Tornado lnstalling Tornado The Basic Framework Building an Application Asynchronous Tornado in Realtime Twitter's Realtime Streaming APIs From the Firehose [ 0 the 嶬第 b Browser Templates in Tornad0 Creating a Template for This Project The JavaScript Parts 6. Chat . Setting Up the Basic C0de The Basic HTML Frame The Python SheII The JavaScript Base Checking the Progress Logging ln On the Server Side JavaScript Basic Chatting Chatting on the Server Side Sending Messages Receiving Messages Acting Natural lnstant Messaging . 7. Getting Started with Google App Engine Setting Up an Account Creating an Application with the SDK 7 一 / 8 8 0 0 つん一 6 フ」っ 0 「 / 9 9- O O つ」 4 「 / 1 1 っ 0 -6 7 「 / 8 8 8 8 8 0 ノ O ′ . 101 101 101 103 105 106 107 107 112 117 117 118 121 121 . 129 130 130 131 Table ofContents

8. 9. 10. Taking Advantage of Google Keeping Track of the User The DepIoy Button The Dashboard Receiving lnstant Messages Sending lnstant Messages Responding lntelligently The Basic Commands Checking Authentication via lnstant Messenger lntroducing a Third Party Setting Up an API SMS Caveats The Game Putting は則 Together . Sending Out Alerts Tracking Backend Traffic and Custom Data Viewing the Traffic Making Sense of the Traffic Catching the Statistics on the Server Sending Tracking Pings with JavaScript Customized Analytics Woopra Chartbeat Realtime Analytics Services Measuring User Engagement: AnaIytics on the Realtime Web . Building an SMS API Authenticating Users Zeep Mobile TextMarks Sending and Receiving the Messages Setting Up the Server Preparing [ 0 Accept Messages The Base Handler An SMS Service Class Extending the lnstant Messaging Application Building the Basic Application SMS APIs Emailto SMS The SMS Landscape 133 135 135 137 138 141 143 143 145 146 149 153 153 153 156 158 158 160 162 163 164 165 165 172 176 180 . 185 185 186 187 189 189 193 198 201 208 214 .. 217 217 217 Table ofContents

Getting Set Up Google App Engine Google Maps API Key EC2 or Other Hosted Server GeoModel The Basic ModeIs UserInfo Disease Germ CommandCenter Textma rk Messenger UserThreats GameUtiIs BuiIding the Game ltself User Authentication Geolocation Spreading Germs Loading Germs Threats Spreading Germs Fighting Germs Realtime Syndication The Command Center lndex . ー TabIe ofContents VIII 218 218 219 220 220 221 222 224 225 227 229 230 232 234 235 235 241 244 251 253 267 269 271 275 295 . 297

Symb01s $HTTP_RAW_POST_DATA variable (PHP), % (percent signs), enclosing Tornad0 日 ow control statements, 92 . (period) in hub parameters, 33 @login—required decorator, 134 @property decorator, 104 @tornado.web.asynchronous decorator, 86 ー (underscore) in HTTP requests, PHP handling of, 33 { } (curly braces) , enclosing arbitrary expressions in Tornado, 92 35 active users list, obtaining from enjoysthin. gs, 13 active. users API call, 17 advice statement (Bayeux protocol), 6() Ajax libraries API, 67 A. mazon EC2 server, 220 Web Services developer website, 220 AMIs (Amazon Machine lnstances), 220 analytics on realtime 嶬第 b , 185 ー 216 Chartbeat service, 186 customized, 189 catching statistics on server, 193 ー 198 making sense 0f traffic, 198 ー 201 sending SMS alerts, 214 ー 216 sending tracking pings with JavaScript, 189 ー 193 tracking backend traffic and custom data, 208 ー 214 lndex viewing traffic, 201 ー 208 Woopra service, 187 Apache, httpd server, 55 , 77 (see alSO Cometd server) APISendHandler class, 149 App Engine, 6 , 130 ー 151 authentication logs on Dashboard, 180 creating application with the SDK, 131 dashboard, 137 Deploy button in Launcher, 136 instant messaging application extended for SMS, 158-160 iPandemic game, 218 making web request with urlfetch module, 147 memcache implementation, 228 modifying main. py file for instant messaging, 133 receiving instant messages, 139 ー 141 responding [ 0 instant messagmg user commands, 143 sending instant messages, 141 setting up an API, 149 ー 151 setting up Google account, 130 signing into your application, 136 taking advantage of Google, 133 urlfetch class, 230 weather information from instant messenger, 146 ー 149 app. yaml file, 132 changing for SMS, 158 XMPP services, 139 Application class (Tornado), 104 URL handler for typing messages, 123 init_ method, 117 We'd like t0 hear your suggestions for improving our indexes. Send email [ ( ) ⅱ ld ビX@池尾〃い . CO 川 . 297

Application ldentifier (App Engine), 131 asynchronous functions, 81 asynchronous methods (chat application), 109 asynchronous Tornado, realtime application, 84 ー 87 Atom, 9 Atom feeds, 16 (see alSO syndication) validators for SUP data in, 26 authentication checking via instant messenger, 145 command center Site (iPandemic game), 279 ー 280 forcing for instant messaging users, 146 HTTP Basic Auth, using for Twitter streaming APIs, 89 users 0f iPandemic game (example), 235 ー 241 users of SMS application, 160 , 176 ー 180 basic code for, 177 process 0f, 176 testing process with Zeep M0bile emulator, 179 with Zeep Mobile, 178 users of SMS Application, 161 using Goog に Account credentials, 134 Authorization header, 89 HTTP requestto Zeep Mobile, 176 available—periods field (SUP file), 12 generating, 24 BaseHandler class (example) App Engine application, 134 chat application, 104 Bayeux protocol, 58 handshake and subscribe processes, 70 in realtimelive blog feed, 68 blogs aggregation 0f updates by FriendFeed, 48 live, 57 realtime live blog, 66 ー 72 callbacks chat clients waiting for, 108 on_new_tweets function (example), requesting, in chat application, 111 298 ー lndex 86 Tornad0 hanging requests via, 81 catcher object, 68 CDN (content delivery network), 190 challenge threats in iPandemic game, 258 ー 259 responding t0, 263 ー 267 handling the response, 266 receiving SMS messages, 264 ー 265 receiving XMPP messages, 263 ー 264 testing response, 267 channels, 59 linking [ 0 Java server-side filters, 73 publishing [ 0 , using dojox. cometd. publish function, 68 Chartbeat (analytics service), 186 chat chatting with instant messaging server, 141 command center, iPandemic game, 289 ー 295 clientside, 293 ー 295 server side, 289 ー 293 initiating t0 App Engine application in iChat, 140 initiating with user via Woopra, 187 chat application, realtime, 101 ー 126 chatting on server side, 117 JavaScript base, 105 logging in, 107 ー 117 JavaScript, 112 ー 117 on server side, 107 ー 112 Python shell, 103 ー 105 receiving messages, 121 seeing that user is typing, 122 ー 126 sending messages, 118 testing, 106 Chat class (example) , 108 ー 111 add—listeners( ) method, 109 add—user( ) method, 109 append—message( ) method, 120 , 121 handle—updates( ) method, 111 , 119 , 121 sending notifications of user typing, 125 keypress( ) method, 118 modifying to show user typing, 124 send—notification( ) method, 109 code examples from this book, x Cometd server, 58 , 60 ー 66 creating web. xml file, 63 ー 65 Demo page, 61 downloading, 60

help With two-connection limit in browsers, 72 initializing connection and Bayeux handshake, 70 initializing connection tO, 68 integrating intO your infrastructure, 77 modifying pom. xml file for Maven, 65 organizing files and directories, 62 starting for live blog application, 69 command center (iPandemic game), 275 ー 295 server side, 289 ー 293 clientside, 293 ー 295 chat, 289 ー 295 basic site, 275 ー 279 authentication, 279 ー 280 69 DOM elements [ 0 display posted content, (see alSO river Of content feed) Dojo, 69 document-serving platform, 从々 b as, 56 Django project, 146 Disease class (example), 224 decorators (Python), 86 db. Model class (App Engine), 135 , 159 viewing the datastore, 137 Datastore API (App Engine), 135 creating in MYSQL, 14 (see also MySQL) databases, 17 dashboard (App Engine), 137 curl utility, 150 trending widget, line class, 47 style entries for trending widget, 41 CSS (Cascading Style Sheets) 267 spreading germs in iPandemic (example), crontab -e command, 21 cron jobs, 261 , 269 content delivery network (CDN), 190 CommandCenter class (example), 227 ー 229 command-line options in Tornado, 83 command line, sending SMS from, 154 notifying users, 283 ー 284 long polling on server, 284 long polling on client side, 285 ー 289 consuming PubSubHubbub, 280 ー 283 D 可 0 Foundation, Cometd server and Bayeux protocol, 58 dOjOX. cometd. init function, 68 dojox. cometd. publish function, 68 , 70 dojox. cometd. subscribe function, 70 DOM elements [ 0 display posted content (live blog feed), 69 EC2 server, 220 echo command, 144 email messages received on a phone, 154 sending SMS via, 153 ー 156 encodeURIComponent function, 44 enjoysthin. gs, 13 Enter key pressed by chat user, 119 event listeners tO catch keypresses in chat application, 118 expressions, Python and Tornad0, 92 Facebook, 79 (see also FriendFeed) entering your wireless carner on, 154 filesystem path for static assets (Tornad0), 83 filters (server-side), using Java, 73 ー 77 filter function for live blog feed, 75 filter-mapping tag, 65 FiIterPasswordCheck class (example), 74 filters parameter, servlet section in web. xml file, 75 init function, 74 Firebug (Firefox extension), 72 firehose feed (Twitter), 87 flow control statements (Python), Tornad0's mapping of, 91 FriendFeed, 48 ー 51 API output in JSONP format, 50 Tornado, 79 validator for SUP feeds, 25 game, building, 217 ー 295 basic models, 221 ー 235 CommandCenter class, 227 ー 229 Disease class, 224 Game class and variables, 221 ー 299 lndex

GameUtils class, 234 Germ class, 225 ー 227 Messenger class, 230 Textmark class, 229 UserInfo class, 222 ー 224 UserThreats class (example) command center, 275 ー 295 EC2 or other hosted server, 220 fighting germs, 270 ー 271 geolocation, 241 GeoModeI, 220 Goog に App Engine, 218 Goog に Maps API key, 220 loading germs, 251 ー 253 realtime syndication, 271 ー 274 settlng up environment, 218 spreading germs, 267 ー 269 spreading germs in cough action, threats, 253 ー 267 initiating challenge, 258 ー 259 naturalthreats, 253 ー 257 244 ー 251 , 232 ー 234 spread of germs in iPandemic game, 245 ー phone supporting JavaScript API calls, 217 geolocation, 2 引ー 244 GameUtils class (example), 234 user authentication, 235 ー 241 updating threats, 260 ー 262 267 responding to challenge threats, 263 ー Shared ltems feed, 33 Goog に Reader Goog に Maps API key, 220 use ofXMPP, 129 urlfetch module, 147 requesting jQuery library from, 204 App Engine (see App Engine) Ajax libraries API, 67 aCCOunt with, 6 Goog に Germ class (example), 225 library, 220 class, 226 , 245 GeoModel 251 300 ー lndex GQL query language, 135 GPS sensors, 4 g00gに . setOnLoadCallback function, subscribing [ 0 Shared ltems feed, 35 69 hanging requests (see long polling) Hash-Based Message Authentication code (HMAC), 175 hashtags in tweets, 90 HTML containing JavaScripttracking code, 197 file for chat application, 101 file for posting con に n い 0 live blog, 67 file laying out basic web page, 94 realtime live blog file, 66 trending on Twitter widget (example), 4() HTTP building requestto Twitter using ur11ib2, 89 GET request header, X-Hub-Subscribers, 29 POST requests hub subscription parameters, 28 hub subscription verification, 29 request routing in Tornado, 81 requests used [ 0 send and receive SMS messages, 162 requests, PHP handling of Underscores in, 33 response header, X-SUP-ID, 17 , 25 standard message delivery, 58 use ln ways not envisioned, 55 application, 140 iChat, initiating chatto App Engine parameters, 29 subscription request verification subscription request parameters, 28 subscribing to, 30 ー 36 PubSubHubbub, 36 reference implementation from publish notifications to, 29 parameters, in PHP, 33 determining if feeds are published to, 27 accepting publish POST request from, 34 hubs 35 $HTTP_RAW_POST_DATA variable (PHP), 77 httpd.conf file, updating [ 0 load proxy module, httpd server, 55 , 77

IDs (SUP), 17 generating for feeds, 25 generating for users, 22 IMUser class (example) adding t0 main. py file, 135 authentication check, 145 index. yaml file, 132 instant messaging, 2 , 129 ー 151 adding weather lookup, 146 ー 149 capabilities in game, Userlnf0 class (example), 223 Chat with website user, initiating with Woopra, 187 checking authentication, 145 extending application t0 handle SMS, 160 Goog に App Engine, 130 ー 139 receiving messages, 139 ー 141 responding [ 0 user commands, 143 sending messages in App Engine application, 141 setting up App Engine API, 149 ー 151 interactions between users and 、 veb applications, 2 158 ー interval for reconnection tO server (Bayeux protocol), 60 iPhone application, Chartbeat, 186 Java Jetty server, 6() server-side filters, 73 JavaScript, 6 chat application (example), 105 adding user [ 0 connected list, 113 clients logging in, 112 modifying UIt0 show user typing, 126 polling server for updates, 115 sending messages, 118 ー 121 code t0 get realtime live blog running, 69 encodeURIComponent function, 44 123 ー 67 , geolocation functionality in iPandemic game, 241 ー 244 river of content feed, realtime live blog, 67 sending tracking pings, 189 ー 193 tracking code added t0 website, 197 trending on Twitter widget, 41 ー 48 twitter. js file (example), 96 ー 99 YUI library, 102 JavaScript Object N0tation (see JSON) Jetty server, 6() running, 61 telling Maven to load it, 66 jQuery library, 96 , 204 JSON OavaScript Object Notation), 6 data structures linking channels [ 0 server- side filters, 73 importing simplejson library int0 App Engine, 146 messages passed tO handler function as objects, 68 Object returned from active. users API call 17 parsing objects using Python simplejson module, 91 simplejson library, Python, 80 JSONDataFilter class, 74 JSONP, 42 output from FriendFeed API, 50 json—decode function, 18 keyword for SMS application rese rving with TextMarks , 165 reserving with Zeep M0bile, 172 Launcher ( Goog に App Engine), 131 application shell, files in, 132 Deploy button, 136 , 140 <link tags> (XML) rel attribute, hub, 27 specifying SUP lDs, 17 , 25 list function, 19 live blogs, 57 realtime, 66 ー 72 realtime updates between browsers, 69 server-side filters (with Java), 73 live images widget, 51 ー 54 logging module (Tornad0), formatted output, 83 login, chat application, 107 ー 117 client side, 112 ー 117 on server side, 107 ー 112 LoginHandler class (chat example), 107 lndex ー 301

logs, viewing in App Engine dashboard, 137 long polling, 58 browser two-connection limit and, 72 client side (iPandemic game control center), 285 ー 289 handling on server (iPandemic game), 284 timeout parameter, 64 Tornad0 support for, 81 measuring user involvement (see analytics on pom. xml file, 65 instructing tO start server for live blog, 76 Maven, 61 changing t0 specify template, 93 Tornado application, 83 chat application, 104 App Engine application, 134 MainHandler class (example) modifying for instant messaging, 133 main function, API request handler, 149 importing simplejson module, 146 adding XMPPHandler class, 139 adding IMUser class, 135 main. py file, 133 mail command, 154 updates to last—update field, 24 updates for user bookmarks, 21 users table (example) entries い b に , syndication_test database creating database and tables, 14 MyS Q L modules section (pom. xml file), 66 ModeI-View-Controller (MVC) framework, 81 mobile devices, 、 veb browsers, 4 /meta channels, 60 Messenger class (example), 230 standard HTTP message delivery, 58 Bayeux protocol, 58 (see also instant messaging; SMS) messaging, 2 message-serving platform, Web as, 56 memcache, 228 realtime 从々 b ) , 36 302 ー lndex 63 namespace, Java source COde in cometd-java, naturalthreats in iPandemic game, 253 ー 257 notification defining notification Object and function (chat example), 109 notification function (chat example), 104 Notifier class (iPandemic command center), 283 ー 284 0 Offline data storage, 4 pass statement (Python), 108 passwords, 89 (see alSO authentication) collecting and passing along with publish request in live blog, 75 requiring for live blog, 73 period field (SUP file), 12 PHP defining PubSubHubBub class (example), 30 json—decode function, 18 list function, 19 SimpleXML extension, 18 , 20 substr function, 22 superglobal variable, $ HTT P_RAW_P OST_DATA, 35 pinging server When no new content available 55 pmgs catching tracking ping statistics on ℃ r, 193 ー 198 sending tracking pings withJavaScript, 189 ー 193 updating and analyzing data from user pings, 198 ー 201 Weblogs.com/ 10 <plugins> tag (XML) , 65 polling, 64 (see also long polling) chat server for updates, 115 long polling ⅲ server push, 58 pom. xml file (Maven), 61 changes [ 0 , 65 POST requests (HTTP), 36 (see also HTTP)

$ HTT P_RAW_P 〇 ST_DATA variable ⅲ PHP, 35 hub subscription requests, 28 hub subscription verification, 29 posting [ 0 hub URL and adding parameters, 31 publish POST requests from hubs, 34 proxy module, installing on Apache httpd server, 77 publish/subscribe services publishing with SUP, 21 ー 26 subscribing with SUP, 13 ー 21 publishing contentto server in live blog feed, 68 in live blog feed, limiting [ 0 authorized users, 73 messages t0 clients in live blog feed, 71 PubSubHubbub protocol, 26-38 publishing with, 36 ー 38 subscribing to feed updates, 280-283 subscribing with, 30 ー 36 subscriptions, 27 pull versus push, 4 push pull versus, 4 server push, 57 ー 60 Python, 6 chat-server. py script, 103 ー 105 chatting on server side, 117 login process, 107 ー 112 LoginHandler class, 107 URL handler for typing messages, decorators, 86 日 OW control statements, mapping in Tornado, 91 FriendFeed validator, 25 Goog に App Engine SDK, 131 main. py file in App Engine, 133 123 modifying for instant messaging, 133 pass statement, 108 pycurl and simplejson libraries, 8() Queue module, 85 re (regular expression) module, findall method, 91 simplejson module, 90 sms. py script, 159 SMSSendHandler class (example), 181 SMSService class (example) , 160 ー 161 Textmark class (example), 168 Thread class, 89 Tornado, 79 uuid, 108 Zeep class (example), 174 queue, setting up [ 0 store Twitter tweets, 85 re (regular expression) module (Python), 91 realtime user experience definition Of realtime, 2 prerequisites for building, 4 regular expresslons matching items commonly found in tweets, 90 searching for images, 53 for URL routed to SMSIncomingHandIer, 165 RequestHandler module (Tornado) , 104 retweets, 9() river of content feed, 57 ー 77 integrating Cometd intO your infrastructure, 77 realtime live blog, 66 ー 72 posting content tO, 67 server push technology, 57 ー 60 server-side filters, 73 ー 77 setting up Cometd environment, 60 ー 66 rot13 command, 144 RSS, 9 RSS feeds, 18 (see alSO syndication) published to hub, 27 validators for SUP data in, 26 rssCloud protocol, IO SendHandler class (chat example) , 117 server push, 57 ー 60 Bayeux protocol, 58 long polling, 58 server-side filters (with Java), 73 ー 77 FiIterPasswordCheck class (example), 74 se rvers designed old way, 55 EC2 or other hosted server, 220 new design t0 handle use 0f HTTP, 56 lndex

setting up SMS server, 164 Tornado, 79 servlet-mapping tag, 64 setOnLoadCallback( ) function, 69 Shared ltems feed ( Goog に Reader), shortcode, 156 prepending specific keyword [ 0 , Simple Update Protocol (see SUP) simplejson library, 80 simplejson module (Python), 91 SimpleXML extension (PHP), 18 reading Atom feed IDs and files, 20 since—time field (SUP file), 13 166 33 building basic application, 158 ー 165 providers, 157 APIs for, 156 216 alerts sent from analytics application, 214 ー SMS (Short Message Service), 2 , 153 ー 183 extending instant messaging application, base RequestHandler class, 162 emailto, 153 ー 156 SMS service class, 160 ー 164 setting up server, 164 preparing t0 accept messages, 163 158 ー 160 receiving messages in iPandemic game, 264 ー streaming APls (realtime), from Twitter, 87 ー statuses/sample streaming API, 88 SMSService class (example), 160-161 SMSSendHandler class (example), 181 177 authentication COde in respond method, SMSIncomingHandler class (example), 163 SMSBaseHandler class (example), 162 users of iPandemic game (example), 223 sending via TextMarks service, 229 using Zeep M0biles service, 172 ー 176 using TextMarks service, 165 ー 172 building SMS API, 180 ー 183 authenticating users, 176 ー 180 sending and receiving messages, 165 265 91 submitPost( ) function, 68 substr function, 22 sum command, 144 SUP (SimpIe Update Protocol), publishing with, 21 ー 26 304 ー lndex 11 generating SUP file, 21 SUP header, 25 testing SUP file, 24 specifying IDs, 17 subscribing with, 13 ー 21 checking the feed, 18 locating feeds, 16 SUP file, 12 ー 26 syndication, 9 ー 38 PubSubHubbub, 26 ー 38 publishing with, 36 ー 38 subscribing with, 30 ー 36 realtime syndication in iPandemic game, 271 ー 274 SUP (SimpIe Update ProtocoI), 11 publishing with SUP, 21 ー 26 subscribing with SUP, 13 ー 21 SUP file, 12 Textmark class (example), 229 in Tornado, 91 creating in Tornad0, 93 chat-main. html (example), 101 templates T object (Tornado example) , 96 ー 99 Twitter realtime streaming APIs, 87 ー 91 static_url function, 103 installing, 80 finish method, 108 define function, 104 103 chat application, chat-server Python script, building an application, 82 ー 84 basic framework, 80 async—callback functionality, 111 asynchronous, in realtime, 84 ー 87 Tornado, 79 ー 100 during, 54 timeout IOOP, new messages accumulating threads, creating in Python, 88 Thread class (Python), 89 testing out application using, 170 reserving a keyword, 165 confirming account with, 167 class handling sending messages from, 168 acquiring API key, 168 TextMarks service, 165 ー 172

Twitter updates, from firehose tO web browser, 91 ー 100 web framework and nonblocking web server, 79 web server, 88 tornado. web. Application function, 83 tornado. web. Application module, 104 tornado. web. RequestHandler module, 104 touch-based interfaces, 4 Tweet class (example), 85 TweetFirehose class (Tornad0 example), 88 TweetProcessor class (Tornad0 example), 89 Twitpic, thumbnail URL, 53 Twitter account for this book, 7 realtime application, asynchronous Tornado, 84 ー 87 realtime streaming APls, 87 ー 91 realtime view Of images streaming intO, 54 trending widget (example), 39 ー 48 TypingHandler class (chat example) , 123 51 ー Unix-like operating systems, sending SMS via command line, 154 updated—time field (SUP file), 12 UpdateHandler class (example) chat application, 111 , 115 Tornad0 application, 86 updates field (SUP file), 13 , 19 urlfetch module (Google) , 147 urllib2, 89 URLs generating for SUP feeds, 26 image service, 53 routing for Tornad0 requests, 83 SUP feeds, 17 thumbnails for image services, 53 topic URL for PubSubHubbub feed, 33 user involvement, measuring (see analytics on realtime 嶬 b ) user-centric 1 れ Odel , 2 UserInf0 class (example), 222 ー 224 UserThreats class (example), 232 ー 234 uuid (Python), 108 validators for Atom/RSS feeds and SUP headers, 26 FriendFeed validator, 25 weather command, 148 weather information via instant messaging, 146 ー 149 web application development, 4 ℃ browsers lndex command for weather information, 147 checking for authenticated users, 145 XMPPHandler class, 139 xmpp module, 140 user identifier in sender field, 145 264 receiving messages in iPandemic game, 263 ー receiving instant messages via, 139 (example) , 223 allowing for users of iPandemic game XMPP, 129 X-SUP-ID headers, 17 , 25 X-Hub-Subscribers headers, 29 Woopra (analytics service), 187 messages, 154 wireless carriers, email address for SMS setting up JavaScript, 41 ー 48 HTML, 40 trending on Twitter (example), 39 ー 48 live images streaming intO Twitter, 51 ー 54 FriendFeed in realtime, 48 ー 51 widgets, 39 ー 56 website-centric model, 2 website for this book, xi, 7 Weblogs.com Pings, IO applications, 64 parameters Of interest [ 0 cometd creating, 63 ー 65 section, 75 adding filters parameter tO <servlet> web. xml file serving, 56 Web, move from document-serving [ 0 message- two-connection limit, 72 realtime updates ⅲ live blog feed, 69

modifying to handle user commands, 143 reply method, 141 Yahoo!, 102 YQL service, 146 yfrog, thumbnail URL, 53 YQL query language, 146 weather information from, loading, 147 YUI JavaScript library, 102 , 106 Panel object, 115 Zeep Mobile, 172 ー 176 authenticating Via virtual device, 179 authenticating with, 178 requests tO, signature in Authorization header, 175 reserving keyword with, 172 306 ー lndex

奥付

BuiIding the ReaItime U 史「 Experience by Ted Roden Copyright ◎ 2010 Ted R0den. AII rights reserved. printed in the United States Of America. published by O'Reilly Media, lnc. , 10()5 Gravenstein Highway North, Sebastopol, CA 95472. O'Reilly books may be purchased for educational, business, or sales promotional use. Online editions are alSO available for most titles ( わ p : 〃川 ). sa. / 4 ⅱわ 00 た SO 〃〃〃巳 CO 襯 ). For more information, contact our corporate/institutional sales department: (8()0) 998-9938 or co 挈 ora 化@0 尾卍 ). co 川 . Editor: Simon St. Laurent Production Editor: Kristen Borg Copyeditor: Genevieve d'Entremont Proofreader: Teresa Barensfeld Production Services: Molly Sharp lndexer: Ellen Troutman Cover Designer: Karen Montgomery lnterior Designer: David Futato lllustrator: Robert Romano Printing History: July 2010: First Edition. Nutshell Handbook, the Nutshell Handb00k 10g0 , and the O'Reilly 10g0 are registered trademarks of O'ReiIIy Media, lnc. BuiIding ビ R ビ記ⅲれ e Use1 ・ Ex 〃夜元ら the image of a myna bird, and related trade dress are trademarks 0f O'Reilly Media, lnc. Many Of the designations used by manufacturers and sellers tO distinguish their products are claimed as trademarks. Where those designations appear in this b00k, and O'Reilly Media, lnc. , was aware Of a trademark claim, the designations have been printed in caps or initial caps. WhiIe every precaution has been taken in the preparation of this book, the publisher and author assume no responsibility for errors or omissions, or for damages resulting frOI れ the use Of the information con- tained herein. ー This book uses RepKoverTM, a durable and flexible lay_flat binding. ISBN: 978-0-596-80615-6 [M] 1277147714